import MinemapGlobe from '../../src/index';

const globe = new MinemapGlobe({
    container: 'globe',
    maskUrl: 'dist/static/images/base.png',
    backgroundUrl: 'dist/static/images/starBackground.jpg'
});

globe.addLayer({
    id: 'dynamic',
    type: 'dynamic-line',
    // color: [255, 212, 19],
    // lineWidth: 10,
    // opacity: 1.0,
    sizeAttenuation: 0.0,
    segmentCount: 450.0,
    segmentGroup: 100.0,
    speed: 0.045,
    path: [
        // 北京-西安
        [[116.40717, 39.90469], [108.939839, 34.34127], 50, 0.3, 0, [255, 212, 19], 1.0, 10],
        // 西安-乌鲁木齐
        [[108.939839, 34.34127], [87.616879, 43.82663], 50, 0.3, 50, [255, 212, 19], 1.0, 10],
        // 乌鲁木齐-塔什干
        [[87.616879, 43.82663], [69.347898, 41.269451], 50, 0.3, 100, [255, 212, 19], 1.0, 10],
        // 塔什干-德黑兰
        [[69.347898, 41.269451], [51.378338, 35.967505], 50, 0.3, 150, [255, 212, 19], 1.0, 10],
        // 德黑兰-安卡拉
        [[51.378338, 35.967505], [32.760274, 39.985151], 50, 0.3, 200, [255, 212, 19], 1.0, 10],
        // 安卡拉-莫斯科
        [[32.760274, 39.985151], [37.641552, 55.728342], 50, 0.3, 250, [255, 212, 19], 1.0, 10],
        // 莫斯科-柏林
        [[37.641552, 55.728342], [13.25, 52.30], 50, 0.3, 300, [255, 212, 19], 1.0, 10],
    ]
});

globe.addLayer({
    id: 'dynamic',
    type: 'dynamic-line',
    // color: [77, 273, 247],
    // lineWidth: 12,
    // opacity: 1.0,
    sizeAttenuation: 0.0,
    segmentCount: 450.0,
    segmentGroup: 100.0,
    speed: 0.045,
    path: [
        // 广州-河内
        [[113.26388, 23.12946], [105.858729, 21.043987], 50, 0.3, 0, [77, 273, 247], 1.0, 10],
        // 河内-雅加达
        [[105.858729, 21.043987], [106.66821, -6.231285], 50, 0.3, 50, [77, 273, 247], 1.0, 10],
        // 雅加达-吉隆坡
        [[106.66821, -6.231285], [101.710138, 3.154866], 50, 0.3, 100, [77, 273, 247], 1.0, 10],
        // 吉隆坡-科伦坡
        [[101.710138, 3.154866], [80.063239, 7.059869], 50, 0.3, 150, [77, 273, 247], 1.0, 10],
        // 科伦坡-吉布提
        [[80.063239, 7.059869], [43.13, 11.6], 50, 0.3, 200, [77, 273, 247], 1.0, 10],
        // 吉布提-雅典
        [[43.13, 11.6], [23.46, 37.58], 50, 0.3, 250, [77, 273, 247], 1.0, 10],
        // 雅典-威尼斯
        [[23.46, 37.58], [12.23, 45.45], 50, 0.3, 300, [77, 273, 247], 1.0, 10],
    ]
});

globe.addLayer({
    id: 'labelImgLayer',
    type: 'label',
    sizeAttenuation: 0.0,
    // 经纬度，宽高（像素），偏移（像素），纹理类型，图片路径/文字内容，点对应球半径
    positions: [
        {
            lngLat: [116.40717, 39.90469],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-orange.png'
        },
        {
            lngLat: [116.40717, 39.90469],
            offset: [0, 16],
            type: 'text',
            content: '北京',
            fontSize: 18
        },
        {
            lngLat: [108.939839, 34.34127],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-orange.png'
        },
        {
            lngLat: [108.939839, 34.34127],
            offset: [0, 16],
            type: 'text',
            content: '西安',
            fontSize: 18
        },
        {
            lngLat: [87.616879, 43.82663],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-orange.png'
        },
        {
            lngLat: [87.616879, 43.82663],
            offset: [0, 16],
            type: 'text',
            content: '乌鲁木齐',
            fontSize: 18
        },
        {
            lngLat: [69.347898, 41.269451],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-orange.png'
        },
        {
            lngLat: [69.347898, 41.269451],
            offset: [0, 16],
            type: 'text',
            content: '塔什干',
            fontSize: 18
        },
        {
            lngLat: [51.378338, 35.967505],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-orange.png'
        },
        {
            lngLat: [51.378338, 35.967505],
            offset: [0, 16],
            type: 'text',
            content: '德黑兰',
            fontSize: 18
        },
        {
            lngLat: [32.760274, 39.985151],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-orange.png'
        },
        {
            lngLat: [32.760274, 39.985151],
            offset: [0, 16],
            type: 'text',
            content: '安卡拉',
            fontSize: 18
        },
        {
            lngLat: [37.641552, 55.728342],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-orange.png'
        },
        {
            lngLat: [37.641552, 55.728342],
            offset: [0, 16],
            type: 'text',
            content: '莫斯科',
            fontSize: 18
        },
        {
            lngLat: [13.25, 52.30],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-orange.png'
        },
        {
            lngLat: [13.25, 52.30],
            offset: [0, 16],
            type: 'text',
            content: '柏林',
            fontSize: 18
        },
        {
            lngLat: [113.26388, 23.12946],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-blue.png'
        },
        {
            lngLat: [113.26388, 23.12946],
            offset: [0, 16],
            type: 'text',
            content: '广州',
            fontSize: 18
        },
        {
            lngLat: [105.858729, 21.043987],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-blue.png'
        },
        {
            lngLat: [105.858729, 21.043987],
            offset: [0, 16],
            type: 'text',
            content: '河内',
            fontSize: 18
        },
        {
            lngLat: [106.66821, -6.231285],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-blue.png'
        },
        {
            lngLat: [106.66821, -6.231285],
            offset: [0, 16],
            type: 'text',
            content: '雅加达',
            fontSize: 18
        },
        {
            lngLat: [101.710138, 3.154866],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-blue.png'
        },
        {
            lngLat: [101.710138, 3.154866],
            offset: [0, 16],
            type: 'text',
            content: '吉隆坡',
            fontSize: 18
        },
        {
            lngLat: [80.063239, 7.059869],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-blue.png'
        },
        {
            lngLat: [80.063239, 7.059869],
            offset: [0, 16],
            type: 'text',
            content: '科伦坡',
            fontSize: 18
        },
        {
            lngLat: [43.13, 11.6],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-blue.png'
        },
        {
            lngLat: [43.13, 11.6],
            offset: [0, 16],
            type: 'text',
            content: '吉布提',
            fontSize: 18
        },
        {
            lngLat: [23.46, 37.58],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-blue.png'
        },
        {
            lngLat: [23.46, 37.58],
            offset: [0, 16],
            type: 'text',
            content: '雅典',
            fontSize: 18
        },
        {
            lngLat: [12.23, 45.45],
            size: [16, 16],
            offset: [0, 0],
            type: 'image',
            content: 'dist/static/images/point-blue.png'
        },
        {
            lngLat: [12.23, 45.45],
            offset: [0, 16],
            type: 'text',
            content: '威尼斯',
            fontSize: 18
        }
    ]
});

globe.fly({
    lng: 105.858729,
    lat: 21.043987,
    zoom: 3
}, {
    lng: 12.23,
    lat: 45.45,
    zoom: 3
}, 9000);

setTimeout(() => {
    globe.fly({
        lng: 12.23,
        lat: 45.45,
        zoom: 3
    }, {
            lng: 105.858729,
            lat: 21.043987,
            zoom: 3
        }, 1000);
}, 9000);

setInterval(() => {
    globe.fly({
        lng: 105.858729,
        lat: 21.043987,
        zoom: 3
    }, {
        lng: 12.23,
        lat: 45.45,
        zoom: 3
    }, 9000);

    setTimeout(() => {
        globe.fly({
            lng: 12.23,
            lat: 45.45,
            zoom: 3
        }, {
            lng: 105.858729,
            lat: 21.043987,
            zoom: 3
        }, 1000);
    }, 9000);
}, 10000);
